#include <REG51.H>
#include <Mode.h>
#include <Key.h>

// 该变量用于只是当前程序运行在何种模式
Mode_TypeDef System_Mode = Mode_Clock;

// 菜单模式时
bit Menu_option = 0;

/**
 * @brief  菜单模式的操作
 * @param  None
 * @retval None
 */
void Mode_menu_crtl(void)
{
    while (System_Mode == Mode_menu)
    {
        switch (Key_Scan())
        {
        case Key0_Down:
            Menu_option = ~Menu_option;
            break;

        case Key1_Down:
            if (Menu_option == 0)
            {
                System_Mode = Mode_Timing;
            }
            else
            {
                System_Mode = Mode_Stopwatch;
            }
            break;

        case Key2_Down:
            System_Mode = Mode_Clock;
            break;
        }
    }
}
